<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('员工列表')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
</head>
<body class="gray-bg">
<div class="ui-layout-center">
    <div class="container-div">

        <div class="row">
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
            <div class="grade">
                <h3>绩效评级：<span id="gradeStatu"></span></h3>
                <h3>最终工资：<span id="salary"></span></h3>
            </div>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:leader:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:leader:remove')}]];
    var prefix = ctx + "worker/performance";

    $(function () {
        var panehHidden = false;
        if ($(this).width() < 769) {
            panehHidden = true;
        }
        $('body').layout({initClosed: panehHidden, west__size: 185});
        queryUserList();
        finalGrade()
    });

    function finalGrade() {
        var finalGrade = 0;
        $.ajax({
            processData: false,
            contentType: false,
            cache: false,
            type: "POST",
            url: ctx + "worker/performance/finalGrade",
            async: false,
            error: function (request) {
                $.modal.alertError("系统错误");
            },
            success: function (data) {
                finalGrade = data;
            }
        })
        if(finalGrade <0 ){
            $('#gradeStatu').append("差");
        }else if(finalGrade >= 0){
            $('#gradeStatu').append("良");
        }
        var salary=3000+ finalGrade*100;
        $('#salary').append("￥"+salary+"元");
    }

    function queryUserList() {
        var options = {
            url: prefix + "/list",
            sortName: "createTime",
            sortOrder: "desc",
            modalName: "绩效统计",
            columns: [
                {
                    field: 'type',
                    title: '类型'
                },
                {
                    field: 'handle',
                    title: '处理方式'
                },
                {
                    field: 'score',
                    title: '单次分数'
                },
                {
                    field: 'total',
                    title: '总计'
                }]
        };
        $.table.init(options);
    }


</script>
</body>
<!-- 导入区域 -->
<script id="importTpl" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="file" name="file"/>
            <div class="mt10 pt5">
                <input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在，更新这条数据。"> 是否更新已经存在的用户数据
                &nbsp; <a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i
                    class="fa fa-file-excel-o"></i> 下载模板</a>
            </div>
            <font color="red" class="pull-left mt10">
                提示：仅允许导入“xls”或“xlsx”格式文件！
            </font>
        </div>
    </form>
</script>
</html>